/*
 * @Author: 张小平
 * @Date:   2025-05-01
 * @Email:  qqshuqian@163.com
 * @Copyright © 2024 aseyun. All rights reserved.
 */
import taskAPI from '@/framework-code/api/task'

const buttonList = {
  data() {
    return {
      buttonList: []
    }
  },
  mounted() {
    if (this.item?.properties?.buttonList) {
      this.buttonList = this.item.properties.buttonList

    } else {
      const procId = this.procId
      if (procId) {
        this.taskButtonList(procId)
      }
    }
  },
  methods: {
    async taskButtonList(procId) {
      try {
        const { data } = await taskAPI.apiButtonList({ procId })
        this.buttonList = data.data.data;
      } catch ({ msg }) {
        this.$message.error(msg)
      }
    },
    handleButtonList(newList) {
      if (newList.length) {
        this.item.properties.buttonList = newList

        // this.$emit('on-item', this.item)
      }
    }
  }
}

export default buttonList
